package database

import "context"

type YDatabaseKey struct{}

func WithCtx(ctx context.Context, db IDataSet) context.Context {
	return context.WithValue(ctx, YDatabaseKey{}, db)
}

func FromCtx(ctx context.Context) (IDataSet, bool) {
	val := ctx.Value(YDatabaseKey{})
	if val == nil {
		return nil, false
	}
	db, ok := val.(IDataSet)
	return db, ok
}
